package com.hello.system.service.impl;

import java.util.List;
import com.hello.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hello.system.mapper.ChatSessionsMapper;
import com.hello.system.domain.ChatSessions;
import com.hello.system.service.IChatSessionsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 聊天会话Service业务层处理
 * 
 * @author hello
 * @date 2025-05-15
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class ChatSessionsServiceImpl extends ServiceImpl<ChatSessionsMapper, ChatSessions> implements IChatSessionsService 
{
    private final ChatSessionsMapper chatSessionsMapper;

    /**
     * 查询聊天会话
     * 
     * @param sessionId 聊天会话主键
     * @return 聊天会话
     */
    @Override
    public ChatSessions selectChatSessionsBySessionId(String sessionId)
    {
        return chatSessionsMapper.selectChatSessionsBySessionId(sessionId);
    }

    /**
     * 查询聊天会话列表
     * 
     * @param chatSessions 聊天会话
     * @return 聊天会话
     */
    @Override
    public List<ChatSessions> selectChatSessionsList(ChatSessions chatSessions)
    {
        return chatSessionsMapper.selectChatSessionsList(chatSessions);
    }

    /**
     * 新增聊天会话
     * 
     * @param chatSessions 聊天会话
     * @return 结果
     */
    @Override
    public int insertChatSessions(ChatSessions chatSessions)
    {
        chatSessions.setCreateTime(DateUtils.getNowDate());
        return chatSessionsMapper.insertChatSessions(chatSessions);
    }

    /**
     * 修改聊天会话
     * 
     * @param chatSessions 聊天会话
     * @return 结果
     */
    @Override
    public int updateChatSessions(ChatSessions chatSessions)
    {
        chatSessions.setUpdateTime(DateUtils.getNowDate());
        return chatSessionsMapper.updateChatSessions(chatSessions);
    }


    /**
     * 批量删除聊天会话
     * 
     * @param sessionIds 需要删除的聊天会话主键
     * @return 结果
     */
    @Override
    public int deleteChatSessionsBySessionIds(String[] sessionIds)
    {
        return chatSessionsMapper.deleteChatSessionsBySessionIds(sessionIds);
    }

    /**
     * 删除聊天会话信息
     * 
     * @param sessionId 聊天会话主键
     * @return 结果
     */
    @Override
    public int deleteChatSessionsBySessionId(String sessionId)
    {
        return chatSessionsMapper.deleteChatSessionsBySessionId(sessionId);
    }
}
